-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[camera_avfoundation] Wrappers swift migration - part 3 #10293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[camera_avfoundation] Wrappers swift migration - part 3 #10293
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request migrates FLTCaptureDevice, FLTCaptureSession, and FLTFormatUtils classes to Swift, removing the FLT prefixes and replacing Default class implementations with protocol conformance on base AV classes. The changes include modifications to the example project and the core implementation, updating tests and adapting to the new Swift conventions. The review focuses on ensuring correctness, maintainability, and adherence to the project's coding standards.
packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraSessionPresetsTests.swift
Show resolved
Hide resolved
packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraSessionPresetsTests.swift
Show resolved
Hide resolved
packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraSettingsTests.swift
Show resolved
Hide resolved
packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraSettingsTests.swift
Show resolved
Hide resolved
packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraSettingsTests.swift
Show resolved
Hide resolved
packages/camera/camera_avfoundation/example/ios/RunnerTests/SampleBufferTests.swift
Show resolved
Hide resolved
packages/camera/camera_avfoundation/example/ios/RunnerTests/SampleBufferTests.swift
Show resolved
Hide resolved
packages/camera/camera_avfoundation/example/ios/RunnerTests/SampleBufferTests.swift
Show resolved
Hide resolved
packages/camera/camera_avfoundation/example/ios/RunnerTests/SampleBufferTests.swift
Show resolved
Hide resolved
.../camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/DefaultCamera.swift
Show resolved
Hide resolved
|
Hi, could you sweep through gemini's comment first? |
|
@hellohuanlin done, there was nothing meaningful there, a bunch of comments regarding argument names in mocks and some streight up invalid suggestions |
49ed2ce to
b67ac9d
Compare
|
@hellohuanlin pls take a look at this PR again when you have some time |
hellohuanlin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good
| let camera = CameraTestUtils.createTestCamera(configuration) | ||
|
|
||
| let range = camera.captureDevice.activeFormat.videoSupportedFrameRateRanges[0] | ||
| let range = camera.captureDevice.fltActiveFormat.videoSupportedFrameRateRanges[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we renaming it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we have to rename it if we want to use protocol extension on AVCaptureDevice instead of wrapping it. With protocol conformance the fields types are invariant so even with FLTCaptureDeviceFormat migrated to swift and AVCaptureDeviceFormat conforming to FLTCaptureDeviceFormat the AVCaptureDevice.activeFormat wouldn't match required CaptureDevice.activeFormat.
| var deviceType = AVCaptureDevice.DeviceType.builtInWideAngleCamera | ||
|
|
||
| var activeFormat: FLTCaptureDeviceFormat { | ||
| var fltActiveFormat: FLTCaptureDeviceFormat { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is FLTCaptureDeviceFormat still in ObjC or is it migrated to Swift?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's still in Objc
...ra/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FormatUtils.swift
Outdated
Show resolved
Hide resolved
...ra/camera_avfoundation/ios/camera_avfoundation/Sources/camera_avfoundation/FormatUtils.swift
Outdated
Show resolved
Hide resolved
b67ac9d to
ec7e9da
Compare
ec7e9da to
4bbc6a5
Compare
Migrates camera wrappers as part of flutter/flutter#119109
This PR migrates wrappers to Swift:
FLTCaptureDeviceFLTCaptureSessionFLTFormatUtilsIn line with Swift conventions, the
FLTprefixes are removed. TheDefaultclass implementations are replaced with protocol conformance on baseAVclasses.Pre-Review Checklist
[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3